package main.test.SparkAPI.Baics.classApi.timerDispl

import java.time.format.DateTimeFormatter
import scala.io.StdIn

object TimerCaller  {
  def main(args: Array[String]): Unit = {


    /**
     * Create a pack for app
     * import use java.time pack
     * coding using class obj trait toghr with acc modf
     * Define an executable obj
     */
    /**
     * goal is to create pro using sbt, it should start ask the suer
     * to enter a time zone, use input to compute curr time,disply it such
     * as RFC 1123("Fri, 26 Aprxx")
     * Let keep things simple, let script crash if user enter invalid time zone
     * // TODO: you learn how to handle exception next unit.
     */
    //Logic
    /**
     * TimePrinter CLASs TAKE CARE OF OUR busi logic
     * it belong to define logic used ot compute curr date and time
     * for give time zone
     * It use three elements of pack java.time
     * Java.time.zooneiD LIST time zone supported, allow you to perform opr on them
     * JAVA.time.zoneDateTime repr dte with time and well defined zone
     * java.time.format.DateTimeFormatter converts a temporal event (e.g. date, time, date-time) to and from a string.
     *
     */
    val timezone = StdIn.readLine("Give me a timezone: ")
    val timePrinter  =
      new TimePrinter(DateTimeFormatter.RFC_1123_DATE_TIME)
    println(timePrinter.now(timezone))

    /**
     * Possible improvements to our app
     * // TODO: error handling if a user enters an invalid time zone
     *           your app will crash with a nasty and diff to understd exception
     *           learn how to create custom exception to provide youruser
     *           with decriptive message about error
     *   TODO: YOUR app is dependent on java.time pack
     *          and its time zone. UTC will be valid but utc not.
     *            Asia/Tokyo vs ASIA/TOKYO
     *
     */

  }



}
